<?php
$subpage = isset($_GET['var2']) ? $_GET['var2'] : "manuals";
$manuals_items = find("select * from manuals_item order by orderId asc, id asc");
$servicescenter_items = find("select * from servicescenter_item order by orderId asc, id asc");
$faq_items = find("select * from faq_item order by orderId asc, id asc");

$subpage_lv2 = isset($_GET['var3']) ? $_GET['var3'] : $manuals_items[0]['titleurl'];
if(isset($_GET['var3'])){
    $subpage_lv2 = $_GET['var3'];
}  else {
    if($subpage == 'manuals'){
        $subpage_lv2 = $manuals_items[0]['titleurl'];
    }  else {
        $subpage_lv2 = $servicescenter_items[0]['titleurl'];
    }
}

if ($subpage == "faq") {
    $right_title = "FAQ";
}

if ($subpage == "manuals") {
    $item = find("select * from manuals_item where titleurl = '$subpage_lv2'", 'single');
    $right_title = $item['title' . $hg];
}

if ($subpage == "servicescenter") {
    $item = find("select * from servicescenter_item where titleurl = '$subpage_lv2'", 'single');
    $right_title = $item['title' . $hg];
}
?>
<div class="left-col">
    <div class="title fsize17"><?= $co_support['titlemenu' . $hg] ?></div>

    <ul class="pl-list">
        <li class="<?= $subpage == "manuals" ? "active" : "" ?>">
            <a href="#"><?= $co_support['manuals_title'.$hg] ?></a>
            <ul>
                <?php foreach ($manuals_items as $key => $row): ?>

                    <li class="<?= $subpage_lv2 == $row['titleurl'] ? "active" : "" ?>">
                        <a href="<?= APPLICATION_URL ?>support/manuals/<?= $row['titleurl'] ?>.html"><?= $row['title' . $hg] ?></a>
                    </li>
                <?php endforeach; ?>
            </ul>
        </li>
        <li class="<?= $subpage == "faq" ? "active" : "" ?>">
            <a href="<?= APPLICATION_URL ?>support/faq.html"><?= $co_support['faq_title'.$hg] ?></a>
        </li>
        <li class="<?= $subpage == "servicescenter" ? "active" : "" ?>">
            <a href="#"><?= $co_support['servicescenter_title'.$hg] ?></a>
            <ul>
                <?php foreach ($servicescenter_items as $key => $row): ?>

                    <li class="<?= $subpage_lv2 == $row['titleurl'] ? "active" : "" ?>">
                        <a href="<?= APPLICATION_URL ?>support/servicescenter/<?= $row['titleurl'] ?>.html"><?= $row['title' . $hg] ?></a>
                    </li>
                <?php endforeach; ?>
            </ul>
        </li>
    </ul>

</div>
<div class="right-col">
    <div class="title"><?= $right_title ?></div>
    <div class="intro content-text">    
        <div class="text <?php if ($subpage != "faq") echo 'su-ctn' ?> ">
            <?php if ($subpage == "faq"): ?>

                <ul class="questions">
                    <?php foreach ($faq_items as $key => $row):?>
                        <li>
                            <div class="question"><?= $row['title' . $hg] ?></div>
                            <div class="answer">
                                <?= $row['content' . $hg] ?>
                            </div>
                        </li>
                    <?php endforeach; ?>
                </ul>

            <?php else: ?>
                <?= $item['content' . $hg]; ?>
            <?php endif; ?>
        </div>
    </div>
</div>
